package com.razorfish.configuration.entities 
{
	import com.razorfish.configuration.parsers.UnknownValue;
	/**
	 * ...
	 * @author derek
	 */
	public class Property extends SingleConfigObject
	{
		public var unknownValue:UnknownValue;
		
		public function Property(data:*, parent:Group)
		{
			super(data, parent);
			if (parent != null)
			{
				this.simpleName = data.name();			
				this.uniqueName = parent.uniqueName + " - " + simpleName;
				SingleConfigObject.registerProperty(this);
			}
			unknownValue = new UnknownValue(data.text());
		}
		
		override public function tryGetValue():void 
		{
			if (isValueReady) return;
			unknownValue.tryGetValue();
			if (unknownValue.isKnown)
			{
				isValueReady = true;
				_value = unknownValue.value;
				trace("!!!!",_value);
			}
		}
		
		public override function get hasDirectValue():Boolean
		{
			if (super.hasDirectValue) return true;
			else
			{
				for each (var obj:SingleConfigObject in this.dependsUpon)
				{
					if (!obj.hasDirectValue) return false;
				}
			}
			
			return true;
		}
	}
}
